<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>商品列表</title>
</head>
<body>


<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet"
      href="${pageContext.request.contextPath}/static/css/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
      href="${pageContext.request.contextPath}/static/css/bootstrap/css/default.css">
<!-- Custom styles for this template -->
<link href="${pageContext.request.contextPath}/static/css/carousel.css"
      rel="stylesheet">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.js"></script>
<script src="${pageContext.request.contextPath}/static/js/functions.js"></script>
<script src="${pageContext.request.contextPath}/static/js/cart.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="${pageContext.request.contextPath}/static/css/bootstrap/js/bootstrap.min.js"></script>
<c:import url="../common/userTopNav.jsp"/>
<script type="text/javascript">
    $(document).ready(function () {
        $("#nav li").removeClass("active");
        $("#nav>li").eq(3).addClass("active");
    });
</script>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <div class="row">
                <div class="col-md-2">
                    <c:import url="../common/userLeftNav.jsp"/>
                </div>

                <div class="col-md-10">
                    <div class="row">
                        <c:if test="${not empty productList}">
                            <c:forEach items="${productList}" var="product">
                                <div class="col-md-4">
                                    <div class="thumbnail">
                                        <a href="${pageContext.request.contextPath}/product/getProductDetail?pid=${product.pid}">
                                            <img alt="暂无图片" src="${product.url} "/>
                                        </a>
                                        <div class="caption text-center"><label> ${product.name} </label>
                                            <p>原价<span class="glyphicon glyphicon-yen"></span>${product.price}
                                                <span class="glyphicon glyphicon-hand-right"></span>
                                            </p>
                                            <p>现售<span class="label label-pill label-info">
                                        <span class="glyphicon glyphicon-yen"></span>${product.offPrice}</span>
                                            </p>
                                            <p>共售出${product.sale}件</p>
                                            <p><a class="btn btn-primary"
                                                  href="${pageContext.request.contextPath}/product/getProductDetail?pid=${product.pid}">查看详情</a>
                                                <!-- <a class="btn btn-primary" href="/springmvc_mybatis/order/buyGoods?goodsId=22" >立即购买</a>
                                    <a class="btn" href="add()">加入购物车</a>  -->
                                            </p>
                                        </div>
                                    </div>
                                </div>
                            </c:forEach>
                        </c:if>
                        <center>
                            <c:if test="${empty productList}">
                                <h2>暂无商品信息</h2>
                            </c:if>
                        </center>
                    </div>

                    <!-- 分页信息 -->

                    <!-- 处理分页参数 -->

                    <table align="center">
                        <tr>
                            <td>
                                <nav>
                                    <ul class="pagination">
                                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共 ${totalCount} 条记录 1 页
                                    </ul>
                                </nav>
                            </td>
                        </tr>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>
<c:import url="../common/userFooter.jsp"/>
</body>
</html>